1 00:00:00,630 --> 00:00:04,350 Hello and welcome to this you in this video. 2 00:00:04,500 --> 00:00:15,540 We are going to add the javascript functionality that all make the conversion tool work inside our hastier 3 00:00:15,540 --> 00:00:22,230 mail are ready made a reference so the external javascript so now we can create the file. 4 00:00:22,260 --> 00:00:34,470 So I'm going to click on file new and I'll save this file on to save us and I'm going to call it cagy 5 00:00:35,640 --> 00:00:39,870 to get daut G. 6 00:00:40,020 --> 00:00:42,700 Yes I see. 7 00:00:43,080 --> 00:00:48,070 So if you look on the bottom right hand corner is now showing as jabba's scripts. 8 00:00:48,120 --> 00:00:53,220 Any code that add in here will be a javascript court. 9 00:00:53,370 --> 00:01:00,280 I've already started to code some and it can explain the code line by line. 10 00:01:01,140 --> 00:01:05,410 So I added the javascript code is not a lot. 11 00:01:05,460 --> 00:01:06,980 I've just run through that with you. 12 00:01:06,980 --> 00:01:16,080 I have created a function called weight converter and inside the parentheses are passed in the Value. 13 00:01:16,080 --> 00:01:18,020 Number two a bizarre glitch. 14 00:01:18,020 --> 00:01:23,640 This will represent the number you passing into the input. 15 00:01:23,700 --> 00:01:37,690 If you're converting from kg to a pound one pound is equivalent of two point to zero for six kg has 16 00:01:37,860 --> 00:01:42,120 created a variable here online to call Val. 17 00:01:42,510 --> 00:01:48,870 This would represent the value of the number you put in a set that took a quarter to the value of that 18 00:01:48,870 --> 00:01:49,820 number. 19 00:01:49,920 --> 00:01:53,370 TIMES TWO point to zero for six. 20 00:01:53,370 --> 00:02:03,270 This is because 1 pound is equivalent to two point two zero forces in kg and here online online 3. 21 00:02:03,280 --> 00:02:09,810 I have created a variable called N and that set that of course to this variable called value. 22 00:02:09,810 --> 00:02:21,030 No dot to fix this is a method that you can use to round up two decimal places so you put the value 23 00:02:21,030 --> 00:02:23,490 of decimal places you want to round it too. 24 00:02:23,490 --> 00:02:28,780 For example if you want the values to be rounded up to one decimal place you pull one. 25 00:02:28,870 --> 00:02:31,380 If you want to decimal places you put two. 26 00:02:31,500 --> 00:02:33,320 In my case I won it. 27 00:02:33,360 --> 00:02:35,060 I don't want any decimal places. 28 00:02:35,070 --> 00:02:37,190 I just won a round number. 29 00:02:37,390 --> 00:02:44,220 So he's going to fix that so that there's no zero numbers out to the number. 30 00:02:44,220 --> 00:02:52,410 So are just going to return a whole number line for here is the document. 31 00:02:52,410 --> 00:02:54,380 Don't get element but. 32 00:02:55,100 --> 00:03:03,030 And this idea is for frame to is called outport pounce telling you to put the value in pownce and we 33 00:03:03,030 --> 00:03:08,310 come here at our hastier mail we can see a reference to that. 34 00:03:08,400 --> 00:03:10,710 I am talking about here. 35 00:03:10,860 --> 00:03:12,420 So I've got an idea here. 36 00:03:12,420 --> 00:03:20,590 This is the I'm talking about the owls Port pownce Okay so this is a Span idea. 37 00:03:20,920 --> 00:03:22,820 That's what I'm referring to here. 38 00:03:23,070 --> 00:03:29,940 So to get this value here and then replace it with the. 39 00:03:29,940 --> 00:03:31,440 In the history AML. 40 00:03:31,440 --> 00:03:40,540 So to use the value of this N which is here if we going to have r t e mail. 41 00:03:41,260 --> 00:03:46,770 So back you can see here inside the jabba's group we have got a variable called N and this is the Vallium 42 00:03:46,840 --> 00:03:50,600 given it so it will grab the document. 43 00:03:50,670 --> 00:03:52,040 Getting on meant by it. 44 00:03:52,050 --> 00:03:57,390 This method will grab this span element which is inherent in a email. 45 00:03:57,580 --> 00:03:58,110 Output. 46 00:03:58,110 --> 00:04:04,740 Pounce on it or attach it to replace that with the value of n t can see. 47 00:04:04,740 --> 00:04:08,640 This is the value of n her right. 48 00:04:08,670 --> 00:04:10,630 So let's save that. 49 00:04:10,720 --> 00:04:19,280 Let's test the application a quick save or someone will pull up the directory and click on the hayse 50 00:04:19,280 --> 00:04:21,880 TMF file to run it. 51 00:04:21,960 --> 00:04:27,070 Now if I put any value in KG for let's say we'll say 9 to 5. 52 00:04:27,360 --> 00:04:36,600 You can see he's giving me the corresponding value in pownce so the functionality of the conversion 53 00:04:36,600 --> 00:04:39,550 tool is working in the next chart. 54 00:04:39,570 --> 00:04:44,820 I'm just going to make it look a little bit nicer by adding some to assess. 55 00:04:44,820 --> 00:04:45,900 Thanks for watching. 56 00:04:45,900 --> 00:04:46,690 Bye for now.